<?php
	include(ROOTPATH .'include'. DS .'protect.php');
	include(ROOTPATH .'include'. DS .'initUser.php');
//	$powder_min = 1 ;
//	include(ROOTPATH .'include'. DS .'checkPowder.php');
	
	include(ROOTPATH .'class'. DS .'task.class.php');
	$page 				= getPage('page');
	$idCode				= getQuery('id');
	$id					= getId('id');
	
	$task = new task();
	
	$sql = 'SELECT * FROM `'. DB_PRE.'task` WHERE `id` = '. $id;	
	$show = $dbs -> select($sql);
	$show = $show[0];
	
	
	
	$sqlCount = 'SELECT count(`id`) as`counts` FROM `'. DB_PRE .'task_invite` WHERE `task_id` = '. $id ;
	$listCount	= $dbs -> select($sqlCount);
	$InviteLen	= $listCount[0]['counts'];	
	
	
 
	
	
	$sql = 'SELECT * FROM `'. DB_PRE.'task_attend` WHERE `task_id` = '. $id;	
	$lists = $dbs -> select($sql);
	
	$isTimeout = false;
	if( $task -> isTimeout($show['timeEnd']))
		$isTimeout = true;	
	
	if( !$isTimeout ){
		$task -> checkOwner($show['user_id']);
		if( $show['user_id'] != $user -> id() && $user -> powder() < 9 )
			header('Location:'.urlRewrite());
	}
	
	 
	//$showUser = new users();
	//$userInfo = $showUser -> getUser($show['user_id']);


?>